import java.util.Vector;

/**
 * 
 */

/**
 * @author inaki_torres
 *
 */
public class Carrera {
	private String racename;
	Circuito miCircuito=new Circuito("Dakar",30) ;
	Vector<Coche> misCoches;
	private int movimientos[misCoches.size()];
	
	/**
	 * @param racename
	 * @param miCircuito
	 */
	public Carrera(String racename, Circuito miCircuito) {
		super();
		this.racename = racename;
		this.miCircuito = miCircuito;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "Carrera [racename=" + racename + ", miCircuito=" + miCircuito
				+ ", misCoches=" + misCoches + "]";
	}
	
	public void meterCoches(Coche c){
		misCoches.add(c);
	}
	
	public Vehiculo correr(){
		for (int i=0;i<misCoches.size();i++){
			movimientos[i]=0;
		}
		for (int i=0;i<misCoches.size();i++){
			movimientos[i]+=misCoches.get(i).mover();
			if (movimientos[i]>= miCircuito.getPosiciones()){
				return misCoches.get(i);
			}//fin if			
		}//fin for
		return misCoches.get(0);	
	}
}
